package com.fjnldx.mes.domain.pojo;

import com.fjnldx.mes.domain.domainReq.VarietyPowerConsumptionReq;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAdjusters;
import java.util.List;

public class EnergyRecordQueryParam {

    private String queryDateTime;
    private String startDateTime = "";
    private String endDateTime = "";
    private String timeType;
    private String bc;
    private String pz;
    private String gongxu;

    public EnergyRecordQueryParam(){
        super();
    }

    public EnergyRecordQueryParam(VarietyPowerConsumptionReq varietyPowerConsumptionReq){
        /*this.pz = varietyPowerConsumptionReq.getPz();
        this.bc = varietyPowerConsumptionReq.getBc();
        this.timeType = varietyPowerConsumptionReq.getTimeType();
        this.gongxu = varietyPowerConsumptionReq.getGongxu();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String queryDateTimeStr = "";
        if("当班".equals(this.timeType)){
            queryDateTimeStr = formatter.format(varietyPowerConsumptionReq.getTime());
            if("甲班".equals(this.bc)){
                this.startDateTime = queryDateTimeStr + "000000";
                this.endDateTime = queryDateTimeStr + "115959";
            }else if("乙班".equals(this.bc)){
                this.startDateTime = queryDateTimeStr + "120000";
                this.endDateTime = queryDateTimeStr + "235959";
            }
            this.queryDateTime = formatter.format(varietyPowerConsumptionReq.getTime());
        }else if("当月".equals(this.timeType)){
            LocalDate time = varietyPowerConsumptionReq.getTime();
            LocalDate firstDay = time.with(TemporalAdjusters.firstDayOfMonth());
            LocalDate lastDay = time.with(TemporalAdjusters.lastDayOfMonth());
            String firstDayStr = formatter.format(firstDay) + "000000";
            String lastDayStr = formatter.format(lastDay) + "235959";
            formatter = DateTimeFormatter.ofPattern("yyyyMM");
            queryDateTimeStr = formatter.format(varietyPowerConsumptionReq.getTime());
            this.queryDateTime = queryDateTimeStr;
            this.startDateTime = firstDayStr;
            this.endDateTime = lastDayStr;
        }else if("当天".equals(this.timeType)){
            String queryDateTime = formatter.format(varietyPowerConsumptionReq.getTime());
            this.startDateTime = queryDateTime + "000000";
            this.endDateTime = queryDateTime + "235959";
            this.queryDateTime = queryDateTime;
        }*/
    }

    public String getQueryDateTime() {
        return queryDateTime;
    }

    public void setQueryDateTime(String queryDateTime) {
        this.queryDateTime = queryDateTime;
    }

    public String getStartDateTime() {
        return startDateTime;
    }

    public void setStartDateTime(String startDateTime) {
        this.startDateTime = startDateTime;
    }

    public String getEndDateTime() {
        return endDateTime;
    }

    public void setEndDateTime(String endDateTime) {
        this.endDateTime = endDateTime;
    }

    public String getTimeType() {
        return timeType;
    }

    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }

    public String getBc() {
        return bc;
    }

    public void setBc(String bc) {
        this.bc = bc;
    }

    public String getPz() {
        return pz;
    }

    public void setPz(String pz) {
        this.pz = pz;
    }

    public String getGongxu() {
        return gongxu;
    }

    public void setGongxu(String gongxu) {
        this.gongxu = gongxu;
    }
}
